package com.thread.plbc;

import java.util.Scanner;

/**
 * @author げっしょく
 * @date 2021/8/5
 */
public class ThreadDemo4 {
    static int money = 10000;
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        ThreadD4exer td = new ThreadD4exer();
        Thread t = new Thread(td);
        t.setName("t1");
        t.start();
        try {
            t.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("main:输入你要取款的金额：");
        int d =sc.nextInt();
        if(d > money){
            System.out.println("余额不够！！");
            System.out.println("您卡里的余额为：" + money);
        }else{
            System.out.println("成功取出" + d  + "元");
            money -= d;
            System.out.println("您卡里的余额还有：" + money + "元");
        }
        td.money = money;

    }
}
